1. /* sdfsfast.cpp by K.Tsuru */
  2. // function ID 3053 DRADIX
  3. /*********************************************************************************
  4. SDouble class
  5. It returs that the SDouble series is faster than the SDecimal one
  6. or not.
  7. 1. When x is short and a recurring decimal in the binary radix,the
  8. D***Series is faster.It may be better to examine that x is also a short value
  9. in the binary radix(e.g. 0.25), but it will be a rare case.
  10. 2.For the relatively long number B***Series is faster even if including the
  11. time costed by the radix conversion.
  12. 3.When |x| is very small, the number of terms is little and the radix conversion
  13. costs a much time. Then D***Series is faster.
  14. This is for the trigonometric functions having a general term as x^n/n!.
  15. For the series whose convergence is late(e.g.AtanSeries) it needs other conditions.
  16. **********************************************************************************/
  17. #ifndef SN_H
  18. #include "sn.h"
  19. #endif
  20. bool DSeriesIsFast(const SDouble& x){
  21. uint xfig = x.Last() - x.First()+1u, ef = x.MaxSize();
  22. int xe = x.RdxExp();
  23. bool fast = false;
  24. if(xe <= -10) return true;
  25. if( (xfig < 32u) || (ef > 1024u) ) return true;
  26. if(xfig < 255u){
  27. if(xe <= -9) fast = true;
  28. } else if(xfig < 510u){
  29. if(xe <= -5) fast = true;
  30. }
  31. return fast;
  32. }

sdfsfast.cpp : last modifiled at 2015/12/03 21:43:53(1,325 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).